﻿<Window x:Class="YogaDictionary.View.WordWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:ignore="http://www.ignore.com"
        xmlns:viewModel="clr-namespace:YogaDictionary.ViewModel"
        mc:Ignorable="d ignore"
        MinHeight="125"
        MinWidth="190"
        Width="500"
        SizeToContent="Height"
        Title="{Binding WordWindowTitle}">
    <Grid HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,10,0,0">
        <Grid.RowDefinitions>
            <RowDefinition Height="25" />
            <RowDefinition />
        </Grid.RowDefinitions>

        <Grid Grid.Row="0" Margin="10,0,0,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>            
            <Label Grid.Column="0" Content="{Binding PrimaryWords}" FontWeight="Bold" />
            <Label Grid.Column="1" Content="{Binding SecondaryWords}" ContentStringFormat="({0})">
                <Label.Style>
                    <Style TargetType="Label">
                        <Style.Triggers>
                            <Trigger Property="Content" Value="">
                                <Setter Property="Visibility" Value="Collapsed" />
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </Label.Style>
            </Label>
        </Grid>
        <WebBrowser Grid.Row="1" viewModel:WebBrowserHelper.Body="{Binding Description}" />
    </Grid>
    
    <Window.InputBindings>
        <KeyBinding Key="Escape" Command="{Binding CloseWindowCommand}" CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}" />
    </Window.InputBindings>
</Window>
